<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit
Response.Buffer = True    
Response.ExpiresAbsolute = Now() - 1    
Response.Expires = 0    
Response.CacheControl = "no-cache"
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="../client_inc/common.function.asp" -->
<!--#include file="../client_inc/common.class.asp" -->
<!--#Include file="../client_inc/sqlsecure.asp"-->
<%
CheckRefresh()
Dim title,author,company,tel,fax,email,content,idpath,typeid,path,lang,rsa,sqla
title=HTMLEncode(request.Form("title"))
if title="" then
	out("lang_emptytitle")
	response.End()
end if
author=HTMLEncode(request.Form("author"))
company=HTMLEncode(request.Form("company"))
tel=HTMLEncode(request.Form("tel"))
fax=HTMLEncode(request.Form("fax"))
email=HTMLEncode(request.Form("email"))
content=HTMLEncode(request.Form("content"))	
idpath=HTMLEncode(request.Form("idpath"))
lang=HTMLEncode(request.querystring("lang"))
If IsEmpty(lang) Or lang="" Or (lang<>"0" And lang<>"1") Then
lang=0
End If 
if content="" then
	out("lang_emptycontent")
	response.End()
end If
If idpath="" Then
	response.write("Invalid1")
	response.End()
ElseIf InStr(idpath,"_")=0 Then 
	response.write("Invalid2")
	response.End()
End If 
if Len(content)>1000 then
	out("lang_lessthen1000")
	response.End()
end If
idpath=Split(idpath,"_")
typeid=idpath(0)
path=FillPath(idpath(1))
If Not isNumber(typeid) Then
	response.write("Invalid3")
	response.End()
End If 


Set rsa = Server.CreateObject("ADODB.Recordset")
sqla = "select * from [c_comment]"
rsa.open sqla,conn,1,3
rsa.addnew
rsa("title")=title
rsa("author")=author
rsa("company")=company
rsa("tel")=tel
rsa("lang")=lang
rsa("fax")=fax
rsa("email")=email
rsa("content")=content
rsa("typeid")=typeid
rsa("path")=path
rsa("addtime")=Now
rsa("modifytime")=Now
rsa("replytime")="2000-1-1 01:01:01"
If app("rz_guestbookaudit")="1" Then 
	rsa("visible")=0
Else
	rsa("visible")=1
End If 
rsa.update
rsa.close
set rsa=Nothing
response.write("alert('"&getstr("lang_saveguestbook")&"');")
If app("rz_sendmail_guestbook")=1  Then 
Dim emailcontent
emailcontent="<h1>"&title&"</h1>"
emailcontent=emailcontent&"作者:"&author&"<br/>"
emailcontent=emailcontent&"公司:"&company&"<br/>"
emailcontent=emailcontent&"电话:"&tel&"<br/>"
emailcontent=emailcontent&"传真:"&fax&"<br/>"
emailcontent=emailcontent&"Emal:"&email&"<br/>"
emailcontent=emailcontent&"时间:"&Now()&"<br/>"
emailcontent=emailcontent&content
emailcontent=emailcontent&"<hr/>"
emailcontent=emailcontent&"详情请登陆网站：<a href="""&app("rz_website_address")&""">"&app("rz_website_address")&"</a>"
Dim rand
randomize
rand=int(90000000*rnd)+10000000
session("sendemail_rand")=rand
response.write("sendMail('新留言："&title&"','"&emailcontent&"','"&rand&"');")
End If 
%>	
